﻿<%@ Page Title="" Language="C#" MasterPageFile="~/LeftColumn.master" AutoEventWireup="true" CodeBehind="AllSales.aspx.cs" Inherits="Supermarket.Web.CashierPages.Inquires.AllSales" %>
<asp:Content ID="Content1" ContentPlaceHolderID="RightContent" runat="server">
    <asp:ScriptManager ID="ScriptManagerAllSales" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="upDatePicker" runat="server">
        <ContentTemplate>
            <div style="width:500px; height:50px">
                <div id="left">
                    <asp:Label Text="От дата: " runat="server" />
                    <asp:TextBox ID="TextBoxFromDate" runat="server" Width="100" />                    
                    <asp:ImageButton ID="ImageButtonFromDate" runat="server" ImageUrl="~/Styles/images/DatePicker.gif"
                        AlternateText="calendar" OnClick="ImageButtonFromDate_Click" CausesValidation="false" />
                    <asp:CompareValidator ID="CompareValidatorFromDate" runat="server" 
                        ErrorMessage="Грешен формат на датата" Display="Dynamic" Type="Date" 
                        Operator="DataTypeCheck" ControlToValidate="TextBoxFromDate" 
                        CssClass="failureNotification">*</asp:CompareValidator>
                    <br />
                    <div id="calendarFrom" class="calendar" visible="false" runat="server">
                        <asp:Calendar ID="CalendarFromDate" runat="server" OnSelectionChanged="CalendarFromDate_SelectionChanged"
                            BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest"
                            Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="200px" ShowGridLines="True"
                            Width="220px">
                            <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
                            <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
                            <OtherMonthDayStyle ForeColor="#CC9966" />
                            <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
                            <SelectorStyle BackColor="#FFCC66" />
                            <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
                            <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
                        </asp:Calendar>
                    </div>
                </div>
                <div id="right">
                    <asp:Label Text="До дата: " runat="server" />
                    <asp:TextBox ID="TextBoxToDate" runat="server" Width="100" 
                        AutoPostBack="True" />
                    <asp:ImageButton ID="ImageButtonToDate" runat="server" ImageUrl="~/Styles/images/DatePicker.gif"
                        AlternateText="calendar" OnClick="ImageButtonToDate_Click" CausesValidation="false" />
                    <asp:CompareValidator ID="CompareValidatorToDate" runat="server" ErrorMessage="Грешен формат на датата" Display="Dynamic" Type="Date" Operator="DataTypeCheck" ControlToValidate="TextBoxToDate" CssClass="failureNotification">*</asp:CompareValidator>
                    <br />
                    <div id="calendarTo" class="calendar" visible="false" runat="server">
                        <asp:Calendar ID="CalendarToDate" runat="server" OnSelectionChanged="CalendarToDate_SelectionChanged"
                            BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest"
                            Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="200px" ShowGridLines="True"
                            Width="220px">
                            <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
                            <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
                            <OtherMonthDayStyle ForeColor="#CC9966" />
                            <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
                            <SelectorStyle BackColor="#FFCC66" />
                            <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
                            <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
                        </asp:Calendar>
                    </div>
                </div>
                <asp:ValidationSummary ID="ValidationSummaryDataError" runat="server" CssClass="failureNotification" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <br /><br />
    <asp:UpdatePanel ID="upSales" runat="server">
        <ContentTemplate>
            <asp:GridView ID="GridViewSales" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" BackColor="#DEBA84" BorderColor="#DEBA84" 
                BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" 
                DataSourceID="odsSales" PageSize="15" AllowSorting="True" 
                DataKeyNames="SaleId,ProductId">
                <Columns>
                    <asp:BoundField DataField="ProductName" HeaderText="Продукт" 
                        SortExpression="ProductName" />
                    <asp:BoundField DataField="Quantity" HeaderText="Количество" 
                        SortExpression="Quantity" />
                    <asp:BoundField DataField="TotalItemPrice" DataFormatString="{0:0.00}" 
                        HeaderText="Общо цена" SortExpression="TotalItemPrice" />
                    <asp:BoundField DataField="SaleOn" HeaderText="Дата на продажба" 
                        SortExpression="SaleOn" />
                </Columns>
                <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
                <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
                <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
                <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
                <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#FFF1D4" />
                <SortedAscendingHeaderStyle BackColor="#B95C30" />
                <SortedDescendingCellStyle BackColor="#F1E5CE" />
                <SortedDescendingHeaderStyle BackColor="#93451F" />
            </asp:GridView>
            <asp:ObjectDataSource ID="odsSales" runat="server" SelectMethod="GetAllSales" 
                SortParameterName="sortExpression"
                TypeName="Supermarket.Bll.InquireManager">
                <SelectParameters>
                    <asp:ControlParameter ControlID="CalendarFromDate" Name="fromDate" 
                        PropertyName="SelectedDate" Type="DateTime" />
                    <asp:ControlParameter ControlID="CalendarToDate" Name="toDate" 
                        PropertyName="SelectedDate" Type="DateTime" />
                    <asp:ControlParameter ControlID="GridViewSales" Name="sortExpression" 
                        PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
